import java.util.ArrayList;

public class PrimeFactors {

    public static void main(String[] args) {
        System.out.println(generate(3));
        System.out.println(generate(30));
    }

    public static ArrayList<Integer> generate(int n) {
        ArrayList<Integer> factors = new ArrayList<Integer>();
        for(int i = 2; i < n; i++) {
            if(n %  i == 0 && isPrime(i)) {
                factors.add(i);
            }
        }
        return factors;
    }

    public static Boolean isPrime(int n)  {
        for(int i = 2; i < n; i++) {
            if(n % i  ==  0) {
                return false;
            }
        }
        return true;
    }
}
